function checkConfirmPassword(){
	if($("#password").val() != $("#confirm-password").val()){
		$("#check-confirm-password").html("These passwords don't match!");
		//$("#error-confirm").html("<img src='/nsn/images/notok.png' width='32' height='32'/>");
		//$("#error-confirm").html("<img src='/nsn/images/notok.png' width='32' height='32'/>");
	}else{
		//$("#error-confirm").html("<img src='/nsn/images/ok.png' width='32' height='32'/>");
		$("#check-confirm-password").html("");
	}	
}

function checkUsername()
{
	var username = $("#username").val();
	if (username.length < 6)
		$("#check-username").html("Username must have at least 6 characters");
	else
		$("#check-username").html("");
}

function checkPassword()
{
	var password = $("#password").val();
	if (password.length < 6)
		$("#check-password").html("Password must have at least 6 characters");
	else
		$("#check-password").html("");
}

function trim(str) {
    return str.replace(/^\s+|\s+$/, '');
}

function checkEmail()
{
	var e = $("#email").val();
    var s = trim(e);
    //var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/;
    var emailFilter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

    if (s != "" && emailFilter.test(s)) {
        /*$.post("/NguoiTimViec/KiemTraEmail", {Email:s}, KiemTra);
        function KiemTra(Taken) {
            if (eval(Taken) == 0) {
                $("#kqktemail").html("<img src='../../Images/Ads/ok.png' width='24' height='24' />")
                return true;
            }
            else {
                $("#kqktemail").html("<img src='../../Images/Ads/notok.png' width='24' height='24' />")
                return false;
            }
        }*/
    	$("#check-email").html("");
    }
    else {
        $("#check-email").html("Email is not valid!");
        //return false;
    }
}

function checkvalid(idinput, idoutput,errormessage)
{
	
	var inp = $("#" + idinput);
	
	var value = inp.val();
	if(value.length < 10) {
		$("#" + idoutput).html(errormessage);		
	}
	else{
		$("#" + idoutput).html("");
	}
}
